﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace CountdownCalendar
{
    public class Settings : INotifyPropertyChanged
    {
        private string _eventDate;
        private string _eventName;
        private bool _weekDaysOnly;

        public string EventDate 
        {
            get
            {
                return _eventDate;
            }
            set
            {
                _eventDate = value;
                RaisePropertyChanged("EventDate");
            }
        }
        public string EventName 
        {
            get
            {
                return _eventName;
            }
            set
            {
                _eventName = value;
                RaisePropertyChanged("EventName");
            }
        }
        public bool WeekDaysOnly 
        {
            get
            {
                return _weekDaysOnly;
            }

            set
            {
                _weekDaysOnly = value;
                RaisePropertyChanged("WeekDaysOnly");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        public Settings()
        {
            EventDate = DateTime.Now.AddDays(3).ToString("MM/dd/yyyy");
            EventName = "?";
        }

        public void Refresh()
        {
            RaisePropertyChanged("EventDate");
            RaisePropertyChanged("EventName");
            RaisePropertyChanged("WeekDaysOnly");
        }

        private void RaisePropertyChanged(string propName)
        {
            if(PropertyChanged!=null)
                PropertyChanged(this,new PropertyChangedEventArgs(propName));
        }
    }
}
